package de.tudarmstadt.ukp.muip.fibqdojo;

import de.tudarmstadt.ukp.muip.fibqdojo.interfaces.IFIBQRule;
import de.tudarmstadt.ukp.muip.fibqdojo.interfaces.IFIBQSentence;

/**
 * This filter should be used in order to remove sentences from the sentence
 * pool. Compared to the {@link SentenceDropFilterFailOneRule} this class drops
 * a sentence if not at least one rules returns <code>true</code>. Hence, if a
 * rule returns true the sentence is kept which is quite the opposite behavior
 * of the other above linked sentence drop filter.
 * 
 * @author Tobias Horsmann
 */
public class SentenceDropFilterFailAllRules extends SentenceDropFilterAbstract {

    public SentenceDropFilterFailAllRules(IFIBQRule... filterRules) {
        super(filterRules);
    }

    @Override
    protected boolean keepSentence(IFIBQSentence sentence) {
        for (IFIBQRule rule : filterRules) {
            if (rule.match(sentence)) {
                return true;
            }
        }
        return false;
    }
}
